﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExecutorMaintain.aspx.cs" Inherits="H2.NET.Web.Workflow.Workflow.ExecutorMaintain" %>

<script type="text/javascript">
    $(function () {
        $("#name", navTab.getCurrentPanel()).InitSelect2("请选择域/用户名",
            "<%= Page.ResolveUrl("~/workflow/ExecutorMaintain.aspx?action=searchName")%>", "name", selectCallBack, "", "2");

        $("#gname", navTab.getCurrentPanel()).InitSelect2("请选择组名",
            "<%= Page.ResolveUrl("~/workflow/ExecutorMaintain.aspx?action=searchGroupName")%>", "name", selectGnameCallBack, "", "1");

        $("#dd_gname").qtip({
            content: "选择组名后，在右侧列表选择已有的用户可进行修改"
        });
    });

    function selectCallBack(data) {
        $.post("<%= Page.ResolveUrl("~/workflow/ExecutorMaintain.aspx?action=searchFullName")%>", { name: data },
        function (result) {
            $("[name='fullname']", navTab.getCurrentPanel()).val(result);
        });
    }

    function selectGnameCallBack(data) {
        $.ajax({
            type: 'POST',
            url: '<%= Page.ResolveUrl("~/workflow/ExecutorMaintain.aspx?action=searchGroups")%>',
            datatype: 'json',
            data: { gname: data },
            success: function (json) {
                var html = "";
                for (var o in json) {
                    html += "<tr>" +
                        "   <td name='j_member'>" + json[o].member + "</td>" +
                        "   <td name='j_membertype'>" + json[o].membertype + "</td>" +
                        "   <td name='j_grouptype'>" + json[o].grouptype + "</td>" +
                        "   <td name='j_gname' style='display:none'>" + json[o].gname + "</td>" +
                        "</tr>";
                }
                $("#tbody_group", navTab.getCurrentPanel()).html(html);
                $(".list", navTab.getCurrentPanel()).cssTable();
                $("#tbody_group tr").click(function () {
                    $("[name='e_oldmember']").val($(this).find("td[name='j_member']").html());
                    $("[name='e_member']").val($(this).find("td[name='j_member']").html());
                    $("[name='e_membertype']").val($(this).find("td[name='j_membertype']").html());
                    $("[name='e_grouptype']").val($(this).find("td[name='j_grouptype']").html());
                    $(":radio[name='actiontype']:eq(1)").attr("checked", "checked");
                });
            }
        });
    }

    function emDialogAjaxDone() {
        DWZ.ajaxDone(json);
        if (json[DWZ.keys.statusCode] == DWZ.statusCode.ok) {
            selectGnameCallBack($("#name").select2("val"));
        }
    }
</script>

<div class="tabs" style="margin: 5px;">
    <div class="tabsHeader">
        <div class="tabsHeaderContent">
            <ul>
                <li><a href="javascript:;"><span>执行人名称维护</span></a></li>
                <li><a href="javascript:;"><span>组成员维护</span></a></li>
            </ul>
        </div>
    </div>
    <div class="tabsContent">
        <div style="background: #fff;">
            <form method="post" action="Workflow/ExecutorMaintain.aspx?action=save" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone, '确定要保存修改吗？');">
                <div class="pageFormContent">
                    <dl>
                        <dt>域/用户名：</dt>
                        <dd>
                            <input type="hidden" name="name" id="name" style="width: 200px" />
                        </dd>
                    </dl>
                    <dl class="nowrap">
                        <dt>用户全称：</dt>
                        <dd>
                            <input class="required" name="fullname" type="text" size="30" />
                        </dd>
                    </dl>
                    <dl>
                        <dt>&nbsp;</dt>
                        <dd>
                            <div class="buttonActive">
                                <div class="buttonContent">
                                    <button type="submit">确认修改</button></div>
                            </div>
                        </dd>
                    </dl>
                </div>
            </form>
        </div>
        <div style="background: #fff;">
            <table>
                <tr>
                    <td style="vertical-align: top; width: 39%;">
                        <%--<div style="border:1px solid #e83e09;background:#fefacf; padding:10px; margin:5px;">选择组名后，在右侧列表选择已有的用户可进行修改</div>--%>
                        <form method="post" action="Workflow/ExecutorMaintain.aspx?action=savegroup" class="pageForm required-validate" onsubmit="return validateCallback(this, emDialogAjaxDone, '确定要提交吗？');">
                            <div class="pageFormContent">
                                <dl>
                                    <dt>操作方式：</dt>
                                    <dd>
                                        <label style="width: auto;">
                                            <input type="radio" name="actiontype" value="add" checked="checked" />新增</label>
                                        <label style="width: auto;">
                                            <input type="radio" name="actiontype" value="update" />修改</label>
                                        <label style="width: auto;">
                                            <input type="radio" name="actiontype" value="delete" />删除</label>
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>组名：</dt>
                                    <dd id="dd_gname">
                                        <input type="hidden" name="gname" id="gname" style="width: 200px" />
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>域用户：</dt>
                                    <dd>
                                        <input type="hidden" name="e_oldmember" />
                                        <input type="text" name="e_member" size="30" />
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>用户类型：</dt>
                                    <dd>
                                        <input type="text" name="e_membertype" size="30" class="digits" style="text-align: left;" /></dd>
                                </dl>
                                <dl>
                                    <dt>组类型：</dt>
                                    <dd>
                                        <input type="text" name="e_grouptype" size="30" class="digits" style="text-align: left;" /></dd>
                                </dl>
                                <dl>
                                    <dt>&nbsp;</dt>
                                    <dd>
                                        <div class="buttonActive">
                                            <div class="buttonContent">
                                                <button type="submit">确认提交</button></div>
                                        </div>
                                    </dd>
                                </dl>
                            </div>
                        </form>
                    </td>
                    <td style="vertical-align: top; width: 1%;"></td>
                    <td style="vertical-align: top; width: 60%;">
                        <table class="list" style="width: 100%; margin: 5px;" layouth="38">
                            <thead>
                                <tr>
                                    <th>域/用户</th>
                                    <th>用户类型</th>
                                    <th>组类型</th>
                                </tr>
                            </thead>
                            <tbody id="tbody_group">
                            </tbody>
                        </table>
                    </td>
                </tr>
            </table>

        </div>
    </div>
    <div class="tabsFooter">
        <div class="tabsFooterContent"></div>
    </div>
</div>
